<template>
  <el-drawer
    :model-value="modelValue"
    :direction="direction"
    :title="title"
    @close="handleClose"
  >
    <slot></slot>
  </el-drawer>
</template>

<script setup lang="ts">
import type { DrawerProps } from 'element-plus'
const {
  modelValue = false,
  direction = 'rtl',
  title = ''
} = defineProps<{
  title?: string
  modelValue: boolean
  direction?: DrawerProps['direction']
}>()

const emit = defineEmits<{
  (e: 'update:modelValue', isOpen: boolean): void
}>()

const handleClose = () => {
  emit('update:modelValue', false)
}
</script>
